<!DOCTYPE html>
<html lang="zh-CN" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>新增员工</title>
    <style>
        * { margin: 0; padding: 0; box-sizing: border-box; }
        body {
            background: url('/images/2.jpg') no-repeat center center fixed;
            background-size: cover;
            font-family: "微软雅黑", sans-serif;
        }
        .main-content {
            margin-left: 200px;
            padding: 20px;
            background-color: rgba(255, 255, 255, 0.5);
            min-height: calc(100vh - 50px);
        }
        .breadcrumb { margin-bottom: 20px; }
        .breadcrumb a { color: #000; text-decoration: none; }
        .form-container {
            background-color: rgba(255, 255, 255, 0.8);
            padding: 20px;
            border-radius: 5px;
            max-width: 600px;
        }
        .form-group { margin-bottom: 15px; }
        .form-group label {
            display: block;
            margin-bottom: 5px;
            font-weight: bold;
        }
        .form-group input, .form-group select {
            width: 100%;
            padding: 8px;
            border: 1px solid #ddd;
            border-radius: 4px;
        }
        .error-msg {
            color: #d9534f;
            margin-bottom: 15px;
            padding: 10px;
            background-color: #f2dede;
            border-radius: 4px;
        }
        .btn-group { text-align: right; margin-top: 20px; }
        .btn {
            padding: 8px 15px;
            border: none;
            border-radius: 4px;
            cursor: pointer;
            margin-left: 10px;
        }
        .btn-submit { background-color: #5cb85c; color: white; }
        .btn-cancel { background-color: #d9534f; color: white; }
    </style>
</head>
<body>
<div th:replace="~{common/common::topbar}"></div>
<div th:replace="~{common/common::sidebar}"></div>

<div class="main-content">
    <div class="breadcrumb">
        <a href="/login.html">系统首页</a> >
        <a href="/employee_info/list">员工信息管理</a> >
        <span class="current-page">新增员工</span>
    </div>

    <div th:if="${not #strings.isEmpty(errorMsg)}" class="error-msg">
        [[${errorMsg}]]
    </div>

    <div class="form-container">
        <h3>新增员工信息</h3>
        <form th:action="@{/employee_info/save}" th:object="${employee}" method="post">
            <div class="form-group">
                <label for="employeeName">员工姓名</label>
                <input type="text" id="employeeName" th:field="*{employeeName}" placeholder="请输入员工姓名" required>
            </div>

            <div class="form-group">
                <label for="position">职位</label>
                <input type="text" id="position" th:field="*{position}" placeholder="请输入职位" required>
            </div>

            <div class="form-group">
                <label for="hireDate">入职日期</label>
                <input type="date" id="hireDate" th:field="*{hireDate}" required>
            </div>

            <div class="form-group">
                <label for="workStatus">工作状态</label>
                <select id="workStatus" th:field="*{workStatus}">
                    <option value="1">在职</option>
                    <option value="0">离职</option>
                </select>
            </div>

            <div class="form-group">
                <label for="permission">权限级别</label>
                <select id="permission" th:field="*{permission}">
                    <option value="1">普通员工</option>
                    <option value="2">管理员</option>
                </select>
            </div>

            <div class="form-group">
                <label for="attendanceRecords">考勤记录（JSON格式）</label>
                <textarea id="attendanceRecords" th:field="*{attendanceRecords}"
                          placeholder='例如：{"2023-10-01":"正常","2023-10-02":"正常"}'
                          rows="3"></textarea>
            </div>

            <div class="btn-group">
                <button type="reset" class="btn btn-cancel">重置</button>
                <button type="submit" class="btn btn-submit">添加员工</button>
            </div>
        </form>
    </div>
</div>
</body>
</html>